﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


class ValidateExpressions
{
    static void Main()
    {
        string expression = Console.ReadLine();
        const char open = '(';
        const char close = ')';
        int openFrequence = new int();
        int closeFrequence = new int();
        bool result = false;
        char[] expressionSymbols = expression.ToCharArray();

        foreach (var symbol in expressionSymbols)
        {
            if (symbol == open)
            {
                openFrequence++;
            }
            else if(symbol == close)
            {
                closeFrequence++;
            }

            if (closeFrequence > openFrequence)
            {
                break;

            }
        }

        if (closeFrequence==openFrequence)
        {
            result = true;
        }

        if (result)
        {
            Console.WriteLine("the expression is correct");
        }
        else
        {
            Console.WriteLine("the explresion is wrong");
        }
    }
}
